package com.sxbbc.common.core.service.impl;

import com.sxbbc.common.core.entity.jz.CTempWx;
import com.sxbbc.common.core.mapper.jz.CTempWxMapper;
import com.sxbbc.common.core.service.ICTempWxService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 小程序或公众号用户信息暂存表 服务实现类
 * </p>
 *
 * @author xiaoky
 * @since 2019-06-01
 */
@Service
public class CTempWxServiceImpl extends ServiceImpl<CTempWxMapper, CTempWx> implements ICTempWxService {

	@Override
	public CTempWx getByMsg(String unionid, String openid, Integer channel) {
		QueryWrapper<CTempWx> wrapper = new QueryWrapper<CTempWx>();
		if (!StringUtils.isEmpty(unionid)) {
			wrapper.eq("unionid", unionid);
		}
		if (!StringUtils.isEmpty(openid)) {
			wrapper.eq("openid", openid);
		}
		wrapper.eq("channel", channel);
		return super.getOne(wrapper);
	}

}
